#include <iostream>  
#include<sstream> 
#include <fstream>
#include <vector>
#include <string>

using namespace std;

string RemoveChinese(char* str);
int CharacterValue(vector<string> str);
int Validline(vector<string> str);


int main()
{
	vector<string> a;

	int words = 0;
	int sum = 0;
	char buffer[2560];
	string buyfferString; 

	ifstream in("input.txt");
	if (!in.is_open())
	{
		cout << "Error opening file"; exit(1);
	}
	while (!in.eof())
	{
		in.getline(buffer, 100);
		cout << RemoveChinese(buffer) << endl;

		a.push_back(RemoveChinese(buffer));

		if (RemoveChinese(buffer) != "")
		{
			sum++;
		}

		istringstream is(RemoveChinese(buffer));
		string s;
		while (is >> s)
		{
			words++;
		}
	}
	ofstream mycout("output.txt");
	cout << sum << endl;

	mycout << "characters:" << words << endl;

	mycout << "words:" << CharacterValue(a) << endl;

	mycout << "lines:" << a.size() << endl;

	mycout.close();

	return 0;
}

string RemoveChinese(char* str)
{
	string qwe;
	for (int i = 0; i < strlen(str); i++)
	{
		if (str[i] - '\0' >= 0 && str[i] - '\0' <= 127)
			qwe += str[i];
	}
	return qwe;
}

int CharacterValue(vector<string> str)
{
	int sum = 0;
	for (int i = 0; i < str.size(); i++)
	{
		sum += str[i].length();
	}
	return sum;
}



